package com.likou.written.hengsheng;

import java.util.Objects;
import java.util.Scanner;

/**
 * Author: 陈桂明
 * Date: 2025/10/10 20:11
 * Description: hengsheng1
 */
public class hengsheng1 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        // while (in.hasNextInt()) { // 注意 while 处理多个 case
        //     int a = in.nextInt();
        //     int b = in.nextInt();
        //     System.out.println(a + b);
        // }

        int n = in.nextInt();
        int ans = in.nextInt();
        int a = in.nextInt();
        int b = in.nextInt();

        int caiCount = 0;
        int wenCount = 0;
        String res = "yes";
        for (int i = 0; i < n; i++) {
            String s = in.next();
            int x = in.nextInt();
            System.out.println("x " + x);
            System.out.println("s " + s);
            if (s.equals("?")) {
                wenCount++;
            } else {
                caiCount++;
            }

            if (i == n - 1 && (!s.equals("!") || x != ans)) {
                res = "no";
            }
        }

        System.out.println(wenCount);
        System.out.println(caiCount);
        if (wenCount > a || caiCount > b) {
            res = "no";
        }

        System.out.println(res);
    }

}
